﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

namespace WebService1
{
    public class ClientFeedBackDAO
    {
        public static bool AddRecordToUpLoad(ClientFeedBackDTO cfbDTO)
        {
            bool result = false;
            SqlConnection connection = new SqlConnection(DataProvider.Connectionstring);
            try
            {
                SqlCommand command = new SqlCommand("INSERT INTO clientfeedback([hoten],[email],[mota],[tu],[idtu]) VALUES (@hoten,@email,@mota,@tu,@idtu)", connection);
                command.Parameters.Add("@hoten", SqlDbType.VarChar).Value = cfbDTO.Hoten;
                command.Parameters.Add("@email", SqlDbType.VarChar).Value = cfbDTO.Email;
                command.Parameters.Add("@mota", SqlDbType.VarChar).Value = cfbDTO.Mota;
                command.Parameters.Add("@tu", SqlDbType.VarChar).Value = cfbDTO.Tu;
                command.Parameters.Add("@mota", SqlDbType.Int).Value = cfbDTO.Iddtu;
                connection.Open();

                if (command.ExecuteNonQuery() != 0)
                    result = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (connection.State != ConnectionState.Closed)
                    connection.Close();
            }
            return result;
        }
    }
}